﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MaterialEdit.aspx.cs" Inherits="BySoft.Web.Site.MasteData.MaterialEdit  "
    MasterPageFile="~/MastePage/SubEmptyMaster.master" %>

<%@ MasterType VirtualPath="~/MastePage/SubEmptyMaster.master" %>
<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="cphHeadContent" runat="server" ContentPlaceHolderID="HeadPlace">
    <script language="javascript" type="text/javascript">
        $(function () {
            $("#tabs").tabs({ show: function (event, ui) { iframeAutoFit(); } });
        })
        
    function CheckNumWithDotOne(txtBox) {
        if (txtBox != null && txtBox.value != "") {
            var numFormat = /(^[0-9]\d{0,9}(\.\d{0,2})?$)/;
            var text = txtBox.value;
            if (!numFormat.test(text)) {
                txtBox.value = 0;
            }
        }
    }

    function FunAddDFile() {
            <%--if ($("#<%=lstFile.ClientID%> option").size() >= 1) {
                return;
            }--%>
        ShowTopDialog('添加文件', '../ComPage/UpPdfPage.aspx?id=3', 'FillDFile();', 500, 200); return false;
    }
    function FillDFile() {
        var str = getCookie(dialogReturn_key);
        if (str != null && str == "success") {
            $("#<%=btnAddDFileHid.ClientID %>").click();
        }
        setCookie(dialogReturn_key, "");
        iframeAutoFit();
    }
    </script>
</asp:Content>
<asp:Content ID="cphContent" runat="server" ContentPlaceHolderID="EmptyMasteCPH">

    <h1 class="tit">基础资料 >> <a href="MaterialList.aspx">原料资料 >></a> 编辑</h1>
    <br />
    <div class="tableStyle2">
        <table border="0" cellspacing="0" cellpadding="0" style="text-align: left; width: 100%" id="tBase" runat="server">
             <tr>
                <th class="left2">类型/小类：
                </th>
                <td class="right2">
                    <asp:DropDownList Enabled="false" CssClass="ddlwidth" ID="ddlMatTypeID" runat="server" OnSelectedIndexChanged="ddlMatTypeID_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>
                    <asp:DropDownList Enabled="false" CssClass="ddlwidth" ID="ddlMatSmallTypeID" runat="server" OnSelectedIndexChanged="ddlMatSamllTypeID_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>

                </td>
                <th class="left2">是否直接材料：
                </th>
                <td class="right2">
                    <asp:CheckBox ID="chkIsDirect" CssClass="ddlwidth" runat="server" Enabled="false" AutoPostBack="true" ></asp:CheckBox>
                      <br />
                    <asp:Label ID="lblDirect" runat="server">注：直接材料－长度、外径必填，间接材料－规格必填。</asp:Label>
                </td>

            </tr>
            <tr>
                <th class="left2">原料编号：
                </th>
                <td class="right2">
                    <asp:Label CssClass="lblreadonly" ID="lblMaterialID" runat="server"></asp:Label>
                </td>
                <th class="left2">原料品名：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtMaterialName" runat="server"></asp:TextBox>
                    <span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ControlToValidate="txtMaterialName" Display="None" ErrorMessage="请输入原料品名！" ID="rfvStockID" ValidationGroup="gSubmit" runat="server"></asp:RequiredFieldValidator>

                </td>

            </tr>
            <tr>
                <th class="left2">规格：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtSpecifications" runat="server"></asp:TextBox>
                   <%-- <span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ControlToValidate="txtSpecifications" Display="None" ErrorMessage="请输入规格！" ID="rfvSpecifications" ValidationGroup="gSubmit" runat="server"></asp:RequiredFieldValidator>--%>
                </td>
                <th class="left2">单位：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtUnit" runat="server"></asp:TextBox>
                </td>

            </tr>

           <tr>
                <th class="left2">长：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtLong" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ControlToValidate="txtLong" Display="None" ErrorMessage="长度最大为4码" ID="revLong"
                        ValidationExpression="\d{0,4}"     ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>
                          </td>
                <th class="left2">宽：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtWidth" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ControlToValidate="txtWidth" Display="None" ErrorMessage="宽度最大为4码" ID="revWidth"
                        ValidationExpression="\d{0,4}"      ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>
                </td>
            </tr>

            <tr>
                <th class="left2">高：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtHeight" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ControlToValidate="txtHeight" Display="None" ErrorMessage="长度最大为4码" ID="revHeight"
                        ValidationExpression="\d{0,4}"    ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>
                </td>
                <td></td>
            </tr>

            <tr>
                <th class="left2">外径：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtOutSide" runat="server" onkeyup="CheckNumWithDotOne(this)"></asp:TextBox>
                    <asp:RegularExpressionValidator ControlToValidate="txtOutSide" Display="None" ErrorMessage="外径最大为4码" ID="revOutSide"
                        ValidationExpression="\d{0,4}"    ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>


                </td>
                <th class="left2">内径：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtInSide" runat="server"></asp:TextBox>
                    <asp:RegularExpressionValidator ControlToValidate="txtInSide" Display="None" ErrorMessage="内径最大为4码" ID="revInSide"
                        ValidationExpression="\d{0,4}"        ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>
                </td>
            </tr>


            <tr>
                <th class="left2">每米重量：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtMeterWeight" runat="server" onkeyup="CheckNumWithDotOne(this)"></asp:TextBox>
                </td>
                <th class="left2">每件几mm：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtMMNumber" runat="server" onkeyup="CheckNumWithDotOne(this)"></asp:TextBox>
                </td>
            </tr>

            <tr>
                <th class="left2">
                </th>
                <td class="right2">
              
                </td>
                <th class="left2">安全库存量：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtSafeStock" runat="server" MaxLength="10" onkeyup="CheckNumWithDotOne(this)"></asp:TextBox>

                </td>
            </tr>
            <tr>
                <th class="left2">到货周期：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtArrivalCycle" runat="server" MaxLength="10" onkeyup="CheckNumWithDotOne(this)"></asp:TextBox>
                    天
                </td>
                <th class="left2">最小订货量：
                </th>
                <td class="right2">
                    <asp:TextBox ID="txtMinOrderNum" CssClass="fullWidth" runat="server" MaxLength="10" onkeyup="CheckNumWithDotOne(this)"></asp:TextBox>
                </td>
            </tr>
            <%--<tr>
               
                <th class="left2">状态：
                </th>
                <td class="right2">
                    <asp:DropDownList CssClass="fullHeight" ID="ddlMaterialStatus" runat="server"></asp:DropDownList>
                </td> 
                <th class="left2">
                </th>
                <td class="right2">
                  
                </td>
            </tr>--%>
        </table>
    </div>
    <div class="tableStyle">
        <div class="ui-tabs ui-widget ui-widget-content ui-corner-all" id="tabs">
            <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
                  <li class="ui-state-default ui-corner-top ui-tabs-selected ui-state-active"><a href="#tabs-1">附档</a></li>
            </ul>
           
            <div id="tabs-1" class="tableStyle ui-tabs-panel ui-widget-content ui-corner-bottom">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <div style="width: 100%; padding-bottom: 10px">
                            <asp:ListBox ID="lstFile" runat="server" Height="35px" Width="70%"></asp:ListBox>
                            <label class="btnStylec png_bg">
                                <asp:Button ID="btnDelFile" runat="server" Text="删除" CssClass="png_bg" OnClick="btnDelFile_Click" /></label>
                            <label class="btnStylec png_bg">
                                <asp:Button ID="btnRead" runat="server" Text="查看" OnClick="btnRead_Click" /></label>
                            <label class="btnStylec png_bg">
                                <input type="button" runat="server" id="btnAddAttachment" value="添加" onclick="FunAddDFile();" class="png_bg" />
                            </label>
                            <asp:Button ID="btnAddDFileHid" runat="server" Text="添加" CssClass="Hidden" OnClick="btnAddDFileHid_Click" />
                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>
    </div>
    <div class="controlBar" align="center">
        <table cellpadding="0" cellspacing="0" style="width: 300px; margin: 0 auto;">
            <tr>
                <td colspan="4">
                    <label class="btnStyleb png_bg">
                        <asp:Button ID="btnSubmit" runat="server" Text="确定" OnClick="btnSubmit_Click" ValidationGroup="gSubmit" />
                    </label>
                    <label class="btnStylec png_bg">
                        <input type="button" id="Button2" value="返回" runat="server" onclick="window.location = 'MaterialList.aspx'" />
                    </label>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>

